package com.atguigu.tingshu.album.service.impl;

import com.atguigu.tingshu.album.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private RedissonClient redissonClient;

    @Override
    @Cacheable(value = "testCache", key = "#id")
    public String getData(Long id) {
        log.info("查询数据开始",id);
        return "data"+id;
    }

    @Override
    @CacheEvict(value = "testCache", key = "#id")
    public void updateData(Long id) {
        log.info("更新数据开始",id);

    }



}
